<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
    //获取100以内的随机数
 	var number = parseInt(Math.random()*100)+1;
    parseFloat
  //	alert(number);
  	var count = 0;
  	function fn1(){
  		count++;
    var d = document.getElementById("d1");
	var i = document.getElementById("i1");
      if(number<i.value){
    	  d.innerText = "大了!";
      }else if(number>i.value){
    	  d.innerText = "小了!";
      }else{
    	  d.innerText = "恭喜您第"+count+"次猜对了!";
      }
	}  
</script>
</head>
<body> 
<input type="text" id="i1">
<input type="button" value="猜一猜" onclick="fn1()">
<div id="d1"></div>
</body>
</html>